class Bank {
    private int money=0;
    public void deposits(){
        money+=100;
    }
    public String toString() { return "    当前余额："+money+"元"; }
    public int getMoney() { return money; }
    public void setMoney(int money) { this.money = money; }
}
class user implements Runnable {
    Bank bank = new Bank();
    public void run(){
        int num = 0;
        for(int i=0;i<3;i++){
            synchronized(this){
                bank.deposits();  //存款操作
                System.out.println( Thread.currentThread().getName() +"正在"+i+"次存100元"+ bank.toString());
            }
        }
    }
}
public class BankWithdrawal {
    public static void main(String[] args) {
        user user = new user();
        new Thread(user,"用户A").start();
        new Thread(user,"用户B").start();
    }
}